package usersManagement.rest;

import usersManagement.service.DuplicateUsernameException;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

/**
 * User: eluibon
 * Date: 21/12/12
 * Time: 14.41
 */
@Provider
public class ServiceExceptionMapper implements ExceptionMapper<DuplicateUsernameException> {

    @Override
    public Response toResponse(DuplicateUsernameException e) {

        return Response.status(500).header("X-Application-Error-Code","DuplicateUsernameException").build();
    }
}
